package com.qidian.mes.cal.controller;

import com.qidian.mes.cal.service.CalShiftService;
import com.qidian.mes.pojo.CalShift;
import com.qidian.mes.util.pojo.MESResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@CrossOrigin
@RequestMapping("/shift")
public class CalShiftController {
    @Autowired
    CalShiftService calShiftService;

    @GetMapping("/list")
    //查询班次信息
    public MESResult list(Long planId) {
        return calShiftService.list(planId);
    }

    @PostMapping("/save")
    //添加计划
    public MESResult save(@RequestBody CalShift calShift) {
        return calShiftService.save(calShift);
    }
    @GetMapping("/get")
    //根据Id查询班次信息
    public MESResult get(Long shiftId) {
        return calShiftService.get(shiftId);
    }

    @PutMapping("/update")
    //修改信息
    public MESResult update(@RequestBody CalShift calShift) {
        return calShiftService.update(calShift);
    }
    @DeleteMapping("deletes")
    //删除班次信息
    public MESResult deletes(Long[] shiftIds) {
        return calShiftService.deletes(shiftIds);
    }
}
